import { FC, memo } from "react";
import { ComponentProps } from "../types/common";
import { useCheckAuth } from "@/hooks/checkLogin";

const CheckAuth: FC<ComponentProps<true>> = memo((props) => {
  const [checkFinished] = useCheckAuth()

  return (
    <div className="w-full h-full">
      {checkFinished && props.children}
      {!checkFinished && (
        <div className="w-full h-full flex-center">
          -- 登录检测中... --
        </div>
      )}
    </div>
  )
})

export default CheckAuth